@echo off
echo Building Logger Module...
echo.

REM Check if build directory exists
if not exist build (
    echo Creating build directory...
    mkdir build
)

cd build

echo Running CMake configuration...
cmake .. -G "MinGW Makefiles"
if %ERRORLEVEL% NEQ 0 (
    echo CMake configuration failed!
    pause
    exit /b 1
)

echo.
echo Starting compilation...
mingw32-make -j4
if %ERRORLEVEL% NEQ 0 (
    echo Compilation failed!
    echo.
    echo Trying single-threaded compilation for clearer error messages...
    mingw32-make VERBOSE=1
    pause
    exit /b 1
)

echo.
echo Build successful!
echo Executables are in the build directory.
echo.
pause
